home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 242 / Issue 242 - April 2008 - DPCS0408DVD.ISO / Software Money Savers / VirtualDub / Source / VirtualDub-1.7.7-src.7z / src / system / source / a_thunk.asm < prev    next >
Encoding:
Assembly Source File  |  2007-09-02  |  2.0 KB  |  66 lines

  1.         .486
  2.         .model    flat
  3.         .code
  4.         
  5.         align        16
  6. _VDMethodToFunctionThunk32    proc public
  7.         pop            eax                    ;get return address in thunk
  8.         
  9.         ;re-copy arguments
  10.         movzx        ecx, byte ptr [eax+1]
  11.         mov            edx, ecx
  12. argsloop:
  13.         push        dword ptr [esp+edx]
  14.         sub            ecx, 4
  15.         jnz            argsloop
  16.  
  17.         push        eax                    ;replace thunk return address
  18.         
  19.         mov            ecx, [eax+7]        ;load 'this' pointer
  20.         jmp            dword ptr [eax+3]    ;tail-call function
  21. _VDMethodToFunctionThunk32    endp
  22.  
  23.         align        16
  24. _VDMethodToFunctionThunk32_4    proc public
  25.         pop            eax                    ;get return address in thunk
  26.         push        dword ptr [esp+4]    ;replicate 1st argument
  27.         push        eax                    ;replace thunk return address
  28.         mov            ecx, [eax+7]        ;load 'this' pointer
  29.         jmp            dword ptr [eax+3]    ;tail-call function
  30. _VDMethodToFunctionThunk32_4    endp
  31.  
  32.         align        16
  33. _VDMethodToFunctionThunk32_8    proc public
  34.         pop            eax                    ;get return address in thunk
  35.         push        dword ptr [esp+8]    ;replicate 2nd argument
  36.         push        dword ptr [esp+8]    ;replicate 1st argument
  37.         push        eax                    ;replace thunk return address
  38.         mov            ecx, [eax+7]        ;load 'this' pointer
  39.         jmp            dword ptr [eax+3]    ;tail-call function
  40. _VDMethodToFunctionThunk32_8    endp
  41.  
  42.         align        16
  43. _VDMethodToFunctionThunk32_12    proc public
  44.         pop            eax                    ;get return address in thunk
  45.         push        dword ptr [esp+12]    ;replicate 3rd argument
  46.         push        dword ptr [esp+12]    ;replicate 2nd argument
  47.         push        dword ptr [esp+12]    ;replicate 1st argument
  48.         push        eax                    ;replace thunk return address
  49.         mov            ecx, [eax+7]        ;load 'this' pointer
  50.         jmp            dword ptr [eax+3]    ;tail-call function
  51. _VDMethodToFunctionThunk32_12    endp
  52.  
  53.         align        16
  54. _VDMethodToFunctionThunk32_16    proc public
  55.         pop            eax                    ;get return address in thunk
  56.         push        dword ptr [esp+16]    ;replicate 4th argument
  57.         push        dword ptr [esp+16]    ;replicate 3rd argument
  58.         push        dword ptr [esp+16]    ;replicate 2nd argument
  59.         push        dword ptr [esp+16]    ;replicate 1st argument
  60.         push        eax                    ;replace thunk return address
  61.         mov            ecx, [eax+7]        ;load 'this' pointer
  62.         jmp            dword ptr [eax+3]    ;tail-call function
  63. _VDMethodToFunctionThunk32_16    endp
  64.  
  65.         end
  66.